package com.lesama.test;

import java.util.Scanner;

public class StringTest3 {
    public static void main(String[] args) {
        encodePhone();
    }
    public static void encodePhone() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的手机号");
        while (true) {
            String phone = sc.next();
            if(phone.length() != 11) {
                System.out.println("对不起，您输入的手机号有误，请重新输入");
            } else {
                String head = phone.substring(0, 3);
                String tail = phone.substring(7);
                System.out.println(head + "****" + tail);
                break;
            }
        }
    }
}
